6578ff3ddb1c9300e311360dfa2f02a1f64c7c61,source/net/yacy/data/DidYouMean.java,DidYouMean,getSuggestions,#number#number#,154

Before Change


            // recursion over several words
            return getSuggestions(this.word.substring(0, lastIndexOfSpace), this.word.substring(lastIndexOfSpace + 1), timeout, preSortSelection, this.segment);
        }
        final SortedSet<StringBuilder> preSorted = getSuggestions(timeout);
        final ReversibleScoreMap<StringBuilder> scored = new ClusteredScoreMap<StringBuilder>(StringBuilderComparator.CASE_INSENSITIVE_ORDER);
        Collection<StringBuilder> countSorted = new ArrayList<StringBuilder>();
        if (this.more) {

After Change


            // several words
            preSorted = getSuggestions(this.word.substring(0, lastIndexOfSpace), this.word.substring(lastIndexOfSpace + 1), timeout, preSortSelection, this.segment);
        } else {
            preSorted = getSuggestions(timeout);
        }
        final ReversibleScoreMap<StringBuilder> scored = new ClusteredScoreMap<StringBuilder>(StringBuilderComparator.CASE_INSENSITIVE_ORDER);
        LinkedHashSet<StringBuilder> countSorted = new LinkedHashSet<StringBuilder>();
        if (this.more) {
            final int wc = this.segment.getWordCountGuess(this.word.toString()); // all counts must be greater than this
            try {
    	        for (final StringBuilder s: preSorted) {
    	            if (System.currentTimeMillis() > timelimit) break;
    	            if (!(scored.sizeSmaller(2 * preSortSelection))) break;
    	            String s0 = s.toString();
    	            int wcg = s0.indexOf(' ') > 0 ? s0.length() * 100 : this.segment.getWordCountGuess(s0);
    	            if (wcg > wc) scored.inc(s, wcg);
    	        }
            } catch (final ConcurrentModificationException e) {
            }
            Iterator<StringBuilder> i = scored.keys(false);
            while (i.hasNext()) countSorted.add(i.next());
        } else {
            try {
                for (final StringBuilder s: preSorted) {
                    if (StringBuilderComparator.CASE_INSENSITIVE_ORDER.startsWith(s, this.word) ||
                        StringBuilderComparator.CASE_INSENSITIVE_ORDER.endsWith(this.word, s)) countSorted.add(this.word);
                }
                for (final StringBuilder s: preSorted) {
                    if (!StringBuilderComparator.CASE_INSENSITIVE_ORDER.equals(s, this.word)) countSorted.add(s);
                }
            } catch (final ConcurrentModificationException e) {